package com.apes.scm.masterdata.enumeration.model;

import com.apes.framework.jpa.BaseModel;
import com.apes.framework.jpa.DefaultPersistListener;
import com.apes.framework.jpa.comment.Comment;
import com.apes.framework.jpa.generator.ApesGenerator;
import com.apes.framework.plugin.fsm.schedule.WorkSchedule;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.SelectBeforeUpdate;

import javax.persistence.*;

/**
 * 标签子表（存储打标签的内容）
 * Created by lishikun on 2021/1/25 14:33
 */
@Getter
@Setter
@SelectBeforeUpdate
@DynamicInsert
@DynamicUpdate
@Entity
@EntityListeners(DefaultPersistListener.class)
@Table(name = TagSub.CONST_TABLE_NAME)
public class TagSub extends BaseModel {
    public static final String CONST_TABLE_NAME = "mas_tag_sub";
    @Id
    @Column(name = "id", length = 16)
    @ApesGenerator(code = CONST_TABLE_NAME, name = "标签子表")
    @Comment("标签子编码")
    private String id;  //编码

    @OneToOne(optional = false)
    @JoinColumn(name = "tag_id", referencedColumnName = "id", nullable = false)
    private Tag tag;

}
